package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.PlanDao;
import com.internship.model.Plan;
import com.internship.page.Page;

@Service
public class PlanService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private PlanDao planDao;

	public Plan getPlanById(int id) {
		return planDao.getPlanById(id);
	}
	public Page<Plan> getPlanList(String DeptCode,int pageNumber) {
		Page<Plan> page = new Page<Plan>(pageNumber, PAGE_SIZE);
		List<Plan> list = planDao.getPlanList(DeptCode, page);
		page.setResultList(list);
		return page;
	}
	public List<Plan> getPlanList() {
		List<Plan> list = planDao.getPlanList();
		return list;
	}
	public int addPlan(Plan plan) {
		return planDao.addPlan(plan);
	}
	public int updatePlan(Plan plan) {
		return planDao.updatePlan(plan);
	}
	public int delPlan(int id) {
		return planDao.delPlan(id);
	}
	public int delAll(String[] ids) {
		return planDao.delAll(ids);
	}

}
